package lang;

public class JDK8JavaDoubleMethodDoubleToLongBits {
    public static void main(String[] args) {
        double a1 = 0.00,
                // 1.0E-315
                a2 = 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,
                a3 = 0;
        System.out.println(a1 == a2); // false
        System.out.println(a2 == a3); // false
        System.out.println(a2 == 202402253); // false
        System.out.println(Double.doubleToLongBits(a1) == Double.doubleToLongBits(a2)); // false
        System.out.println(Double.doubleToLongBits(a2) == Double.doubleToLongBits(a3)); // false
        System.out.println(Double.doubleToLongBits(a2) == 202402253); // true

    }
    public static void test1(){
        double a1 = 0.00,
                // 1.0E-315
                a2 = 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,
                a3 = 0;
        System.out.println(a1 == a2); // false
        System.out.println(a2 == a3); // false
        System.out.println(a2 == 202402253); // false
    }
    public static void test2(){
        double a1 = 0.00,
                // 1.0E-315
                a2 = 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,
                a3 = 0;

        System.out.println(Double.doubleToLongBits(a1) == Double.doubleToLongBits(a2)); // false
        System.out.println(Double.doubleToLongBits(a2) == Double.doubleToLongBits(a3)); // false
        System.out.println(Double.doubleToLongBits(a2) == 202402253); // true
    }
    public static void test3(){
        double a1 = 0.01,a2 = 0.00001,a3 = 0;

        System.out.println(a1 == a2); // false
        System.out.println(a1 == a3); // false
    }
    public static void test4(){
        double a1 = 0.01,a2 = 0.00001,a3 = 0;

        System.out.println(Double.doubleToLongBits(a1) == Double.doubleToLongBits(a2)); // false
        System.out.println(Double.doubleToLongBits(a1) == Double.doubleToLongBits(a3)); // false
    }
}
